TEntity
IdeaBlade DevForce 2010 Help Reference
FirstOrNullEntity<TEntity>(IEntityQuery<TEntity>) Method
See Also  Example Send Feedback
IdeaBlade.EntityModel Assembly > IdeaBlade.EntityModel Namespace > EntityQueryExtensions Class > FirstOrNullEntity Method : FirstOrNullEntity<TEntity>(IEntityQuery<TEntity>) Method



source1
Returns the first element of a sequence, or the appropriate NullEntity if no element is found.

Syntax

Visual Basic (Declaration) 
<ExtensionAttribute()>
Public Overloads Shared Function FirstOrNullEntity(Of TEntity As Class)( _
   ByVal source1 As IEntityQuery(Of TEntity) _
) As TEntity
Visual Basic (Usage)Copy Code
Dim source1 As IEntityQuery(Of TEntity)
Dim value As TEntity
 
value = EntityQueryExtensions.FirstOrNullEntity(Of TEntity)(source1)
C# 
[ExtensionAttribute()]
public static TEntity FirstOrNullEntity<TEntity>( 
   IEntityQuery<TEntity> source1
)
where TEntity: class
C++/CLI 
[ExtensionAttribute()]
public:
static TEntity^ FirstOrNullEntitygeneric<typename TEntity>
( 
   IEntityQuery<TEntity^>^ source1
) 
where TEntity: ref class

Parameters

source1

Type Parameters

TEntity

Example

C#Copy Code
var mgr1 = new DomainModelEntityManager();
Customer cust = mgr1.Customers.Where(c => c.Country == "UK").FirstOrNullEntity();

Requirements

Target Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, Windows Vista, Windows Server 2008 family

See Also

© 2013 All Rights Reserved.